﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Manage/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QianBuo.Lottery.Web.Models.User.TakeMoneys>" %>
<%@ Import Namespace="Code.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	提款详情
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    

<div>
        <% Html.BeginForm(); %>
        <table width="100%" class="table">
            <tr class="th">
                <th colspan="6" align="left">
                    &nbsp;&nbsp;搜索条件</th>
            </tr>
            <tr>
                <td>
                    <%=Html.LabelFor(p=>p.where.AddTime_Start) %>：从
                    <%=Html.TextBoxFor(p => p.where.AddTime_Start, new { @class = "text100", onClick="WdatePicker()" })%>
                    <%=Html.ValidationMessageFor(p=>p.where.AddTime_Start) %>
                </td>
                <td>
                    到
                    <%=Html.TextBoxFor(p => p.where.AddTime_End, new { @class = "text100", onClick = "WdatePicker()" })%>
                    <%=Html.ValidationMessageFor(p => p.where.AddTime_End)%>
                </td>
                <td>
                    <%=Html.LabelFor(p=>p.where.Money) %>
                    <%=Html.TextBoxFor(p=>p.where.Money, new { @class = "text100" }) %>
                    <%=Html.ValidationMessageFor(p=>p.where.Money) %>
                </td>
                <td>
                    <%=Html.LabelFor(p=>p.where.State)%>
                    <%var list=Enum.GetValues(typeof(TakeMoneyState)).Cast<TakeMoneyState>()
                        .Select(p=>new SelectListItem{ Text=p.GetName(),Value=((short)p).ToString(),Selected=Model.where.State==(short)p}).ToList();
                        list.Insert(0,new SelectListItem{ Selected=Model.where.State==-1, Text="所有状态", Value="-2"}); %>
                    <%=Html.DropDownListFor(p=>p.where.State,list) %>
                </td>
                <td rowspan='3' width="100px" align="center">
                    <input type="submit" value="查找" />
                </td>
            </tr>
        </table>
        <p />
        <% Html.EndForm(); %>
        <table id='TakeMoneyDetail_Table' class="table" width="100%">
            <tr class="th">
                <th>用户名</th><th>真实姓名</th><th>金额</th><th>申请时间</th><th>状态</th><th>备注</th><th>操作</th>
            </tr>
            <%
              var i = 0 ;
              foreach (var item in Model.TakeMoneyList)
              {
                  var remark = string.IsNullOrEmpty(item.Remark.Replace("&","")) ? "" : item.Remark.Replace("&&", "管理员说:").Replace("&", item.User.LoginName+"说:");
                  var routeValue = Url.Route(new { id = item.User.Uid, tackMoneyID = item.ID, returnUrl = Url.Action("TakeMoneyDetail", "User", Url.Route(new { pageInfo = new { Model.PageInfo.CurrPage },Model.where, returnUrl = Request["returnUrl"] })) });
                  %>
                  <tr <%=i++%2==1?"class='supersede'":"" %>>
                    <td><%=item.User.LoginName %></td>
                    <td><%=item.User.RName %></td>
                    <td><%=(double)item.Money%></td>
                    <td><%=item.AddTime%></td>
                    <td><%=((Code.Models.TakeMoneyState)item.State).GetName()%></td>
                    <td><label title='<%=remark %>'><%=string.IsNullOrEmpty(remark)?"": (remark.Length > 20 ? remark.Substring(0, 20) : remark)%></label></td>
                    <td>
                        <%if (item.State == (short)TakeMoneyState.UnDispose)
                          { %>
                            <%=Html.ActionLink("处理", "Dispose", "User", routeValue, Url.Route(new {@class="a_blue" }))%>
                        <%}
                          else {
                            %><%=Html.ActionLink("查看", "Dispose", "User", routeValue, Url.Route(new { @class = "a_blue" }))%>
                         <% } %>
                    </td>
                  </tr>
             <%} if (Model.PageInfo != null && Model.PageInfo.PageCount > 1)
              { %>
             <tr>
                 <td colspan='7' align="center">
                    <%=Html.Pager(Model.PageInfo.CurrPage, Model.PageInfo.PageCount, Model.PageInfo.SunCount, "PageInfo.CurrPage", Url.Route(new { Model.where }), "PageInfo.PageCount")%>
                 </td>
             </tr>
             <%} %>
        </table>
    <%if (Request["ReturnUrl"] != null)
      {%>
    <a class="a_blue" href='<%=Request["ReturnUrl"] %>'>&gt;&gt;返回</a>
    <%} %>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="StyleAndScript" runat="server">
<script type="text/javascript">
    function GetTakeMoney() {
        getJSON('<%=Url.Action("GetTakeMoney", "User")%>', null, function (data) {
            if (data.list != null&&data.list.length>0) {
                CreateTR(data.list);
            }
            setTimeout('GetTakeMoney()', 5000);
        });
    }
    function CreateTR(list) {
        <%
            var newRouteValue = Url.Route(new { returnUrl = Url.Action("TakeMoneyDetail", "User", Url.Route(new { pageInfo = new { Model.PageInfo.CurrPage }, Model.where, returnUrl = Request["returnUrl"] })) });
            var url = Url.Action("Dispose", "User", newRouteValue);
        %>
        var doUrl='<%=url %>';
        var table = document.getElementById('TakeMoneyDetail_Table');
        for (var i = 0; i < list.length; i++) {
            var tr = table.insertRow(i + 1);
            if (i % 2 == 1) {
                tr.className = 'supersede';
            }
            var td_Name = tr.insertCell(-1);
            var span1 = document.createElement('span');
            span1.innerText = list[i].name;
            td_Name.appendChild(span1);

            var td_Money = tr.insertCell(-1);
            var span2 = document.createElement('span');
            span2.innerText = list[i].Money;
            td_Money.appendChild(span2);

            var td_Time = tr.insertCell(-1);
            var span3 = document.createElement('span');
            span3.innerText = list[i].AddTime;
            td_Time.appendChild(span3);

            var td_State = tr.insertCell(-1);
            var span4 = document.createElement('span');
            span4.innerText = '未处理';
            td_State.appendChild(span4);

            var td_Remark = tr.insertCell(-1);
            var span5 = document.createElement('span');
            var remark=list[i].Remark;
            if(remark==null||remark.replace('&','')==''){
                remark='';
            }else{
                remark=remark.replace(/&&/g,'管理员说:').replace(/&/g,list[i].name+'说:');
            }
            with(span5){
                title=list[i].Remark;
            }
            if(remark!=null){
                remark=remark.substr(0,20);
                span5.innerText = remark;
            }
            td_Remark.appendChild(span5);

            var td_Do = tr.insertCell(-1);
            var span6 = document.createElement('span');
            span6.innerHTML = '<a class=\'a_blue\' href='+doUrl + '&id=' + list[i].Uid + '&tackMoneyID='+list[i].ID+'>处理</a>';
            td_Do.appendChild(span6);
        }
    }
    setTimeout('GetTakeMoney()', 1000);
</script>
</asp:Content>